
package cn.edu.scau.cmi.hombio.service;

import cn.edu.scau.cmi.hombio.domain.CureTaskMedicine;
import cn.edu.scau.cmi.hombio.domain.CureTaskMethod;
import cn.edu.scau.cmi.hombio.domain.Medicine;
import cn.edu.scau.cmi.hombio.domain.Unit;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/pigRs-security-context.xml",
		"file:./resources/pigRs-service-context.xml",
		"file:./resources/pigRs-dao-context.xml",
		"file:./resources/pigRs-web-context.xml" })
@Transactional
public class CureTaskMedicineServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected CureTaskMedicineService service;

	/**
	 * Instantiates a new CureTaskMedicineServiceTest.
	 *
	 */
	public CureTaskMedicineServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	* Delete an existing Medicine entity
	* 
	 */
	@Test
	public void deleteCureTaskMedicineMedicine() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMedicineMedicine 
		Integer curetaskmedicine_id = 0;
		Integer related_medicine_id = 0;
		CureTaskMedicine response = null;
		response = service.deleteCureTaskMedicineMedicine(curetaskmedicine_id, related_medicine_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteCureTaskMedicineMedicine
	}

	/**
	 * Operation Unit Test
	* Save an existing Unit entity
	* 
	 */
	@Test
	public void saveCureTaskMedicineUnit() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMedicineUnit 
		Integer id = 0;
		Unit related_unit = new cn.edu.scau.cmi.hombio.domain.Unit();
		CureTaskMedicine response = null;
		response = service.saveCureTaskMedicineUnit(id, related_unit);
		// TODO: JUnit - Add assertions to test outputs of operation: saveCureTaskMedicineUnit
	}

	/**
	 * Operation Unit Test
	* Save an existing CureTaskMedicine entity
	* 
	 */
	@Test
	public void saveCureTaskMedicine() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMedicine 
		CureTaskMedicine curetaskmedicine = new cn.edu.scau.cmi.hombio.domain.CureTaskMedicine();
		service.saveCureTaskMedicine(curetaskmedicine);
	}

	/**
	 * Operation Unit Test
	* Return a count of all CureTaskMedicine entity
	* 
	 */
	@Test
	public void countCureTaskMedicines() {
		Integer response = null;
		response = service.countCureTaskMedicines();
		// TODO: JUnit - Add assertions to test outputs of operation: countCureTaskMedicines
	}

	/**
	 * Operation Unit Test
	* Delete an existing CureTaskMethod entity
	* 
	 */
	@Test
	public void deleteCureTaskMedicineCureTaskMethod() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMedicineCureTaskMethod 
		Integer curetaskmedicine_id_1 = 0;
		Integer related_curetaskmethod_id = 0;
		CureTaskMedicine response = null;
		response = service.deleteCureTaskMedicineCureTaskMethod(curetaskmedicine_id_1, related_curetaskmethod_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteCureTaskMedicineCureTaskMethod
	}

	/**
	 * Operation Unit Test
	* Delete an existing Unit entity
	* 
	 */
	@Test
	public void deleteCureTaskMedicineUnit() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMedicineUnit 
		Integer curetaskmedicine_id_2 = 0;
		Integer related_unit_id = 0;
		CureTaskMedicine response = null;
		response = service.deleteCureTaskMedicineUnit(curetaskmedicine_id_2, related_unit_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteCureTaskMedicineUnit
	}

	/**
	 * Operation Unit Test
	* Delete an existing CureTaskMedicine entity
	* 
	 */
	@Test
	public void deleteCureTaskMedicine() {
		// TODO: JUnit - Populate test inputs for operation: deleteCureTaskMedicine 
		CureTaskMedicine curetaskmedicine_1 = new cn.edu.scau.cmi.hombio.domain.CureTaskMedicine();
		service.deleteCureTaskMedicine(curetaskmedicine_1);
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findCureTaskMedicineByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findCureTaskMedicineByPrimaryKey 
		Integer id_1 = 0;
		CureTaskMedicine response = null;
		response = service.findCureTaskMedicineByPrimaryKey(id_1);
		// TODO: JUnit - Add assertions to test outputs of operation: findCureTaskMedicineByPrimaryKey
	}

	/**
	 * Operation Unit Test
	* Return all CureTaskMedicine entity
	* 
	 */
	@Test
	public void findAllCureTaskMedicines() {
		// TODO: JUnit - Populate test inputs for operation: findAllCureTaskMedicines 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<CureTaskMedicine> response = null;
		response = service.findAllCureTaskMedicines(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllCureTaskMedicines
	}

	/**
	 * Operation Unit Test
	* Save an existing Medicine entity
	* 
	 */
	@Test
	public void saveCureTaskMedicineMedicine() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMedicineMedicine 
		Integer id_2 = 0;
		Medicine related_medicine = new cn.edu.scau.cmi.hombio.domain.Medicine();
		CureTaskMedicine response = null;
		response = service.saveCureTaskMedicineMedicine(id_2, related_medicine);
		// TODO: JUnit - Add assertions to test outputs of operation: saveCureTaskMedicineMedicine
	}

	/**
	 * Operation Unit Test
	* Save an existing CureTaskMethod entity
	* 
	 */
	@Test
	public void saveCureTaskMedicineCureTaskMethod() {
		// TODO: JUnit - Populate test inputs for operation: saveCureTaskMedicineCureTaskMethod 
		Integer id_3 = 0;
		CureTaskMethod related_curetaskmethod = new cn.edu.scau.cmi.hombio.domain.CureTaskMethod();
		CureTaskMedicine response = null;
		response = service.saveCureTaskMedicineCureTaskMethod(id_3, related_curetaskmethod);
		// TODO: JUnit - Add assertions to test outputs of operation: saveCureTaskMedicineCureTaskMethod
	}

	/**
	 * Operation Unit Test
	* Load an existing CureTaskMedicine entity
	* 
	 */
	@Test
	public void loadCureTaskMedicines() {
		Set<CureTaskMedicine> response = null;
		response = service.loadCureTaskMedicines();
		// TODO: JUnit - Add assertions to test outputs of operation: loadCureTaskMedicines
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
